package com.regent.central.bill.service.bean;

import com.regent.central.bill.core.Remittance;
import com.regent.central.bill.repository.RemittanceMapper;
import com.regent.central.bill.service.RemittanceService;
import com.regent.central.infrastructure.service.bean.DomainServiceBean;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Service
public class RemittanceServiceBean extends DomainServiceBean<RemittanceMapper, Remittance> implements RemittanceService {
    /**
     * 更新汇款记录
     *
     * @param remittanceId  汇款记录ID
     * @param remitMethodId 汇款方式ID
     * @param amount        汇款总金额
     * @param dateOperated  汇款时间
     */
    @Override
    public void update(String remittanceId, String remitMethodId, BigDecimal amount, Date dateOperated) {
        mapper.update(remittanceId, remitMethodId, amount, dateOperated);
    }

    /**
     * 撤销汇款记录
     *
     * @param remittanceId 汇款记录
     * @param userCanceled 撤销人
     */
    @Override
    public void cancel(String remittanceId, String userCanceled) {
        mapper.cancel(remittanceId, userCanceled);
    }

    /**
     * 获取销售单的汇款记录
     *
     * @param saleOrderId 销售单ID
     * @return 销售单的汇款记录
     */
    @Override
    public List<Remittance> getSaleOrderRemittances(String saleOrderId) {
        return getSaleOrderRemittances(saleOrderId, false, false);
    }

    /**
     * 获取销售单的汇款记录
     *
     * @param saleOrderId 销售单ID
     * @param canceled    已撤销
     * @param deleted     已删除
     * @return 销售单的汇款记录
     */
    @Override
    public List<Remittance> getSaleOrderRemittances(String saleOrderId, Boolean canceled, Boolean deleted) {
        return mapper.getSaleOrderRemittances(saleOrderId, canceled, deleted);
    }
}